package com.example.filterlog;

import org.springframework.boot.web.servlet.FilterRegistrationBean;

/**
 * <p> 将 LogFilter 过滤器封装成 Spring Bean </p>
 *
 * @author Chris
 * @since 2022/12/9 14:30
 */
public class LogFilterRegistrationBean extends FilterRegistrationBean<LogFilter> {

    public LogFilterRegistrationBean() {
        super();
        // 添加 LogFilter 过滤器
        this.setFilter(new LogFilter());
        // 匹配所有路径
        this.addUrlPatterns("/*");
        // 定义过滤器名
        this.setName("LogFilter");
        // 设置优先级
        this.setOrder(1);
    }

}